package cn.sxt.yxl.head.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.sxt.yxl.question.pojo.AColumns;
import cn.sxt.yxl.question.pojo.AColumnsEnum;
import cn.sxt.yxl.question.service.IQuestionService;

/**
 * 首页模块的controller (不需要登录)
 * @author CHZ
 *
 */

@Controller
public class IndexNoLoginController {

	@Resource
	private IQuestionService questionService;
	/* 进入首页 */
	@RequestMapping("/main")
	public String main(){
		
		return "/head/main";
	}
	/**
	 * 显示所有栏目
	 */
	@RequestMapping("/header")
	public String header(HttpServletRequest request){
		/* 查询所有栏目 */
		Map<String, Object> condMap = new HashMap<String, Object>();
		/* 查询状态为启用的栏目 */
		condMap.put("status", AColumnsEnum.STATUS_ENABLE.getStatus());
		List<AColumns> columnsList = this.questionService.findCondAdminListService(null, condMap);
		/* 将查询结果放到作用域 */
		request.setAttribute("columnsList", columnsList);
		return "/head/header";
	}
	
}

